home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / src / td01_src.lha / td_r0.1 / s2 / source / eps / postscript.c next >
Encoding:
C/C++ Source or Header  |  1999-04-05  |  19.6 KB  |  545 lines

  1. /*
  2. **      $VER: postscript.c 1.00 (5.4.1999)
  3. **
  4. **      Creation date : 23.01.1999
  5. **
  6. **      Description       :
  7. **         Standart saver module for meshwriter.library.
  8. **         Saves the mesh as PostScript file.
  9. **
  10. **
  11. **      Written by Stephan Bielmann
  12. **
  13. */
  14.  
  15. /*************************** Includes *******************************/
  16.  
  17. /*
  18. ** Amiga includes
  19. */
  20. #include <dos/dos.h>
  21. #include <dos/stdio.h>
  22.  
  23. #include <clib/dos_protos.h>
  24. #include <clib/alib_stdio_protos.h>
  25.  
  26. /*
  27. ** Project includes
  28. */
  29. #include "meshwriter_private.h"
  30. #include "utilities.h"
  31.  
  32. /**************************** Defines *******************************/
  33.  
  34. // Margin percent factor
  35. #define Ci_MARGINPERFAC 0.025
  36.  
  37. // Extraspace to fit the object in the drawing box
  38. #define Ci_EXTRASPACE 0.95
  39.  
  40. /*********************** Type definitions ***************************/
  41.  
  42. typedef struct {
  43.     FLOAT x,y;
  44. } PSVector;
  45.  
  46. /********************** Private functions ***************************/
  47.  
  48. /********************************************************************\
  49. *                                                                    *
  50. * Name         : writepoints                                         *
  51. *                                                                    *
  52. * Description  : Writes all vertices of the mesh with the p macro in *
  53. *                a specific view.                                    *
  54. *                                                                    *
  55. * Arguments    : psfile      IN : An already opened file stream.     *
  56. *                mesh        IN : Pointer to the mesh.               *
  57. *                viewtype    IN : Type of view.                      *
  58. *                scale       IN : Scaling factor.                    *
  59. *                xo,yo,yb    IN : Offsets and bottom of display.     *
  60. *                                                                    *
  61. * Return Value : RCNOERROR                                           *
  62. *                RCWRITEDATA                                         *
  63. *                                                                    *
  64. * Comment      :                                                     *
  65. *                                                                    *
  66. \********************************************************************/
  67. static ULONG writepoints(BPTR psfile,TOCLMesh *mesh,ULONG viewtype,
  68.                             FLOAT scale,FLOAT xo,FLOAT yo,FLOAT yb) {
  69.  
  70.     UBYTE                     buffer[100];
  71.     TOCLVertexNode            *ver=NULL;
  72.     TOCLVertex             v;
  73.     TOCLFloat                x,y;
  74.  
  75.       if(mesh->vertices.firstNode!=NULL) {
  76.         ver=mesh->vertices.firstNode;
  77.         do {
  78.             v=ver->vertex;
  79.  
  80.             switch(viewtype) {
  81.                 case TVWTOP:
  82.                     x=xo+scale*(v.x-mesh->bBox.left);
  83.                     y=yo+scale*(v.y-mesh->bBox.rear);
  84.                     break;
  85.                 case TVWBOTTOM:
  86.                     x=xo+scale*(v.x-mesh->bBox.left);
  87.                     y=yo+scale*(-v.y+mesh->bBox.front);
  88.                     break;
  89.                 case TVWRIGHT:
  90.                     x=xo+scale*(v.y-mesh->bBox.rear);
  91.                     y=yo+scale*(v.z-mesh->bBox.bottom);
  92.                     break;
  93.                 case TVWLEFT:
  94.                     x=xo+scale*(-v.y+mesh->bBox.front);
  95.                     y=yo+scale*(v.z-mesh->bBox.bottom);
  96.                     break;
  97.                 case TVWFRONT:
  98.                     x=xo+scale*(v.x-mesh->bBox.left);
  99.                     y=yo+scale*(v.z-mesh->bBox.bottom);
  100.                     break;
  101.                 case TVWREAR:
  102.                     x=xo+scale*(-v.x+mesh->bBox.right);
  103.                     y=yo+scale*(v.z-mesh->bBox.bottom);
  104.                     break;
  105.                 case TVWPERSP:
  106.                     break;
  107.             }
  108.  
  109.             sprintf(buffer,"%g %g p\n",x,y);
  110.             if(FPuts(psfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  111.             ver=ver->next;
  112.         } while(ver!=NULL);
  113.     }
  114.  
  115.     return(RCNOERROR);
  116. }
  117.  
  118. /********************************************************************\
  119. *                                                                    *
  120. * Name         : writeview                                           *
  121. *                                                                    *
  122. * Description  : Writes a specific view of the mesh.                 *
  123. *                                                                    *
  124. * Arguments    : epsfile     IN : An already opened file stream.     *
  125. *                mesh        IN : Pointer to the mesh.               *
  126. *                viewtype    IN : Type of view.                      *
  127. *                drawmode    IN : Drawing mode.                      *
  128. *                xsize,ysize IN : Size of the box to draw.           *
  129. *
  130. *                                                                    *
  131. * Return Value : RCNOERROR                                           *
  132. *                RCWRITEDATA                                         *
  133. *                                                                    *
  134. * Comment      :                                                     *
  135. *                                                                    *
  136. \********************************************************************/
  137. static ULONG writeview(BPTR epsfile,TOCLMesh *mesh,ULONG viewtype,
  138.                        ULONG drawmode,FLOAT xsize,FLOAT ysize) {
  139.     UBYTE     buffer[80];
  140.     FLOAT    scale,xratio,yratio,zratio,xoffset,yoffset,ybottom;
  141.     ULONG                    retval;
  142.  
  143.     // with the bbox compute the scaling factor and he offsets
  144.     if(mesh->bBox.right-mesh->bBox.left>0.0) {
  145.         xratio=1.0/(mesh->bBox.right-mesh->bBox.left)
  146.     } else {
  147.         xratio=1.0;
  148.     }
  149.     if(mesh->bBox.front-mesh->bBox.rear>0.0) {
  150.         yratio=1.0/(mesh->bBox.front-mesh->bBox.rear)
  151.     } else {
  152.         yratio=1.0;
  153.     }
  154.     if(mesh->bBox.top-mesh->bBox.bottom>0.0) {
  155.         zratio=1.0/(mesh->bBox.top-mesh->bBox.bottom)
  156.     } else {
  157.         zratio=1.0;
  158.     }
  159.     scale=(ysize*yratio<xsize*yratio?ysize*yratio:xsize*yratio);
  160.     scale=(scale<ysize*zratio?scale:ysize*zratio);
  161.     scale=(scale<xsize*xratio?scale:xsize*xratio);
  162.     // expand it a little
  163.     scale*=Ci_EXTRASPACE;
  164.  
  165.     switch(viewtype) {
  166.         case TVWTOP:
  167.         case TVWBOTTOM:
  168.             xoffset=(xsize-scale/xratio)/2.0;
  169.             yoffset=(ysize-scale/yratio)/2.0;
  170.             break;
  171.         case TVWFRONT:
  172.         case TVWREAR:
  173.             xoffset=(xsize-scale/xratio)/2.0;
  174.             yoffset=(ysize-scale/zratio)/2.0;            
  175.             break;
  176.         case TVWRIGHT:
  177.         case TVWLEFT:
  178.             xoffset=(xsize-scale/yratio)/2.0;
  179.             yoffset=(ysize-scale/zratio)/2.0;            
  180.             break;
  181.         case TVWPERSP:
  182.  
  183.             break;
  184.     }
  185.  
  186.     // draw a box around this view
  187.     sprintf(buffer,"0 0 m %g 0 r 0 %g r %g 0 r cp s\n",xsize,ysize,-xsize);
  188.     if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  189.  
  190.     retval=RCNOERROR;
  191.  
  192.     switch(drawmode) {
  193.         case TDMPOINTS:
  194.             retval=writepoints(epsfile,mesh,viewtype,scale,xoffset,yoffset,ybottom);
  195.             break;
  196.  
  197.         case TDMWIREBW:
  198.         case TDMWIREGR:
  199.         case TDMWIRECL:
  200.             //writewire;
  201.             break;
  202. /*
  203. case TDMHIDDBW
  204. case TDMHIDDGR
  205. case TDMHIDDCL
  206.  
  207. case TDMSURFBW
  208. case TDMSURFGR
  209. case TDMSURFCL
  210. */
  211.     }
  212.  
  213.     return(retval);
  214. }
  215.  
  216. /********************************************************************\
  217. *                                                                    *
  218. * Name         : writeepsheader                                      *
  219. *                                                                    *
  220. * Description  : Writes the Encapsulated PostScript header.          *
  221. *                                                                    *
  222. * Arguments    : psfile      IN : An already opened file stream.     *
  223. *                mesh        IN : Pointer to the mesh.               *
  224. *                x,y,h,w     IN : The PS bounding box.               *
  225. *                drawmode    IN : Drawing mode.                      *
  226. *                                                                    *
  227. * Return Value : RCNOERROR                                           *
  228. *                RCWRITEDATA                                         *
  229. *                                                                    *
  230. * Comment      :                                                     *
  231. *                                                                    *
  232. \********************************************************************/
  233. static ULONG writeepsheader(BPTR epsfile,TOCLMesh *mesh,TOCLFloat x,
  234.                     TOCLFloat y,TOCLFloat w,TOCLFloat h, ULONG drawmode) {
  235.  
  236.     UBYTE     buffer[100];
  237.     TOCLMaterialNode    *mat=NULL;
  238.     TOCLFloat            r,g,b;
  239.  
  240.     if (FPuts(epsfile,"%!PS-Adobe-2.0 EPSF-1.2\n%%Creator: (MeshWriterLibrary)\n")!=DOSFALSE) return(RCWRITEDATA);
  241.  
  242.     if (FPrintf(epsfile,"%%%%For: (%s)\n%%%%Title: (%s)\n",
  243.                 mesh->copyright,mesh->name)==ENDSTREAMCH) return(RCWRITEDATA);
  244.  
  245.     sprintf(buffer,"%%%%BoundingBox: %g %g %g %g\n",x,y,w,h);
  246.  
  247.     if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  248.  
  249.     if (FPuts(epsfile,"%%EndComments\n\n%%BeginProlog\n")!=DOSFALSE) return(RCWRITEDATA);
  250.  
  251.     // write the static prolog
  252.     if (FPuts(epsfile,"/bd {bind def} bind def\n")!=DOSFALSE) return(RCWRITEDATA);
  253.     if (FPuts(epsfile,"/m {moveto} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  254.     if (FPuts(epsfile,"/l {lineto} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  255.     if (FPuts(epsfile,"/r {rlineto} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  256.     if (FPuts(epsfile,"/cp {closepath} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  257.     if (FPuts(epsfile,"/s {stroke} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  258.  
  259.     // write the dynamic prolog in function of the drawing mode
  260.     switch (drawmode) {
  261.         case TDMPOINTS : {
  262.             if (FPuts(epsfile,"/p {1 360 0 arcn cp fill} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  263.             break;
  264.         }
  265.         case TDMWIREBW : {
  266.             if (FPuts(epsfile,"/p {m l l cp s} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  267.             break;
  268.         }
  269.         case TDMWIRECL : {
  270.             if (FPuts(epsfile,"/p {m l l cp gsave 0 setgray s grestore c exch get aload pop setrgbcolor} bd\n")!=DOSFALSE) return(RCWRITEDATA);
  271.  
  272.             if(mesh->materials.firstNode!=NULL) {
  273.                 if (FPuts(epsfile,"/c [\n")!=DOSFALSE) return(RCWRITEDATA);
  274.           
  275.                 mat=mesh->materials.firstNode;
  276.                 do {
  277.                     TOCLColor col=mat->ambientColor;
  278.                     r=col.r,g=col.g,b=col.b;
  279.                     sprintf(buffer,"[%g %g %g]\n",r/255,g/255,b/255);
  280.                     if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  281.                     mat=mat->next;
  282.                 } while(mat!=NULL);
  283.  
  284.                 if (FPuts(epsfile,"] def\n")!=DOSFALSE) return(RCWRITEDATA);
  285.             } else {
  286.                 if (FPuts(epsfile,"/c [[1 1 1]] def\n")!=DOSFALSE) return(RCWRITEDATA);
  287.             }
  288.             break;
  289.         }
  290.     }
  291.  
  292.     if (FPuts(epsfile,"%%EndProlog\n\n0 setgray 0 setlinecap 0.1 setlinewidth 2 setlinejoin [] 0 setdash newpath\n\n")!=DOSFALSE) return(RCWRITEDATA);
  293.  
  294.     return(RCNOERROR);
  295. }
  296.  
  297. /********************************************************************\
  298. *                                                                    *
  299. * Name         : writeepsbody                                        *
  300. *                                                                    *
  301. * Description  : Writes the body of the eps file.                    *
  302. *                                                                    *
  303. * Arguments    : epsfile  IN : An already opened file stream.        *
  304. *                mesh     IN : Pointer to the mesh.                  *
  305. *                viewtype IN : Type of view.                         *
  306. *                drawmode IN : Drawing mode.                         *
  307. *                x,y,w,h  IN : X/Y position and width/height of box. *
  308. *                                                                    *
  309. * Return Value : RCNOERROR                                           *
  310. *                RCWRITEDATA                                         *
  311. *                                                                    *
  312. * Comment      :                                                     *
  313. *                                                                    *
  314. \********************************************************************/
  315. static writeepsbody(BPTR epsfile,TOCLMesh *mesh,
  316.                     ULONG viewtype,ULONG drawmode,
  317.                     FLOAT x,FLOAT y,FLOAT w,FLOAT h) {
  318.  
  319.     UBYTE     buffer[50];
  320.     FLOAT    tx,ty,w2,h2;
  321.     ULONG    retval;
  322.  
  323.     if(viewtype==TVW4SIDES) {
  324.         w2=w/2,h2=h/2;
  325.  
  326.         tx=x,ty=y;
  327.         sprintf(buffer,"gsave %g %g translate\n",tx,ty);
  328.         if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  329.         retval=writeview(epsfile,mesh,TVWFRONT,drawmode,w2,h2);
  330.         if(retval!=RCNOERROR) return(retval);
  331.         if (FPuts(epsfile,"grestore\n")!=DOSFALSE) return(RCWRITEDATA);
  332.         tx=x,ty=y+h2;
  333.         sprintf(buffer,"gsave %g %g translate\n",tx,ty);
  334.         if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  335.         retval=writeview(epsfile,mesh,TVWTOP,drawmode,w2,h2);
  336.         if(retval!=RCNOERROR) return(retval);
  337.         if (FPuts(epsfile,"grestore\n")!=DOSFALSE) return(RCWRITEDATA);
  338.         tx=x+w2,ty=y+h2;
  339.         sprintf(buffer,"gsave %g %g translate\n",tx,ty);
  340.         if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  341.         retval=writeview(epsfile,mesh,TVWPERSP,drawmode,w2,h2);
  342.         if(retval!=RCNOERROR) return(retval);
  343.         if (FPuts(epsfile,"grestore\n")!=DOSFALSE) return(RCWRITEDATA);
  344.         tx=x+w2,ty=y;
  345.         sprintf(buffer,"gsave %g %g translate\n",tx,ty);
  346.         if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  347.         retval=writeview(epsfile,mesh,TVWRIGHT,drawmode,w2,h2);
  348.         if(retval!=RCNOERROR) return(retval);
  349.         if (FPuts(epsfile,"grestore\n")!=DOSFALSE) return(RCWRITEDATA);
  350.     } else {
  351.         tx=x,ty=y;
  352.         sprintf(buffer,"gsave %g %g translate\n",tx,ty);
  353.         if (FPuts(epsfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  354.         retval=writeview(epsfile,mesh,viewtype,drawmode,w,h);
  355.         if(retval!=RCNOERROR) return(retval);
  356.         if (FPuts(epsfile,"grestore\n")!=DOSFALSE) return(RCWRITEDATA);        
  357.     }
  358.  
  359.     return(RCNOERROR);
  360. }
  361.  
  362. /********************************************************************\
  363. *                                                                    *
  364. * Name         : writeepsfooter                                      *
  365. *                                                                    *
  366. * Description  : Writes the Encapsulated PostScript footer.          *
  367. *                                                                    *
  368. * Arguments    : psfile      IN : An already opened file stream.     *
  369. *                                                                    *
  370. * Return Value : RCNOERROR                                           *
  371. *                RCWRITEDATA                                         *
  372. *                                                                    *
  373. * Comment      :                                                     *
  374. *                                                                    *
  375. \********************************************************************/
  376. static ULONG writeepsfooter(BPTR epsfile) {
  377.  
  378.     if (FPuts(epsfile,"\nshowpage\n\n%%EOF\n")!=DOSFALSE) return(RCWRITEDATA);
  379.  
  380.     return(RCNOERROR);
  381. }
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388. /********************************************************************\
  389. *                                                                    *
  390. * Name         : writegrid                                           *
  391. *                                                                    *
  392. * Description  : Writes the mesh as grid with the p macro in a       *
  393. *                specific view.                                      *
  394. *                                                                    *
  395. * Arguments    : psfile      IN : An already opened file stream.     *
  396. *                mesh        IN : Pointer to the mesh.               *
  397. *                viewtype    IN : Type of view.                      *
  398. *                scale       IN : Scaling factor.                    *
  399. *                colors      IN : True if with colors, else b/w.     *
  400. *                                                                    *
  401. * Return Value : RCNOERROR                                           *
  402. *                RCWRITEDATA                                         *
  403. *                                                                    *
  404. * Comment      :                                                     *
  405. *                                                                    *
  406. \********************************************************************/
  407. static ULONG writegrid(BPTR psfile,TOCLMesh *mesh,ULONG viewtype,
  408.                             FLOAT scale, BOOL colors) {
  409.  
  410.     UBYTE                         buffer[200];
  411.     TOCLPolygonNode            *pln=NULL;    
  412.     TOCLPolygonsVerticesNode    *plvi=NULL,*plv1=NULL,*plv2=NULL,*plv3=NULL;
  413.     TOCLVertex                    ver1,ver2,ver3;
  414.     TOCLFloat                    x1,y1,x2,y2,x3,y3;
  415.  
  416.  
  417.       if(mesh->polygons.firstNode!=NULL) {                 
  418.         pln=mesh->polygons.firstNode;
  419.         do {
  420.             /* Get the first point of the polygon, used to create all triangles with it */
  421.             if(pln->numberOfVertices>=3) {
  422.                 plv1=pln->firstNode;
  423.                 ver1=plv1->vertexNode->vertex;
  424.             
  425.                 plvi=plv1;
  426.                 do {    
  427.                     plv2=plvi->next;
  428.                     plv3=plv2->next;
  429.                 
  430.                     ver2=plv2->vertexNode->vertex;
  431.                     ver3=plv3->vertexNode->vertex;
  432.  
  433.                     switch(viewtype) {
  434.                         case TVWTOP : {
  435.                             x1=ver1.x*scale,y1=ver1.y*scale;
  436.                             x2=ver2.x*scale,y2=ver2.y*scale;
  437.                             x3=ver3.x*scale,y3=ver3.y*scale;
  438.                             break;
  439.                         }
  440.                         case TVWBOTTOM : {
  441.                             x1=ver1.x*scale,y1=-ver1.y*scale;
  442.                             x2=ver2.x*scale,y2=-ver2.y*scale;
  443.                             x3=ver3.x*scale,y3=-ver3.y*scale;
  444.                             break;
  445.                         }
  446.                         case TVWLEFT : {
  447.                             x1=ver1.y*scale,y1=ver1.z*scale;
  448.                             x2=ver2.y*scale,y2=ver2.z*scale;
  449.                             x3=ver3.y*scale,y3=ver3.z*scale;
  450.                             break;
  451.                         }
  452.                         case TVWRIGHT : {
  453.                             x1=ver1.y*scale,y1=-ver1.z*scale;
  454.                             x2=ver2.y*scale,y2=-ver2.z*scale;
  455.                             x3=ver3.y*scale,y3=-ver3.z*scale;
  456.                             break;
  457.                         }
  458.                         case TVWFRONT : {
  459.                             x1=ver1.x*scale,y1=ver1.z*scale;
  460.                             x2=ver2.x*scale,y2=ver2.z*scale;
  461.                             x3=ver3.x*scale,y3=ver3.z*scale;
  462.                             break;
  463.                         }
  464.                         case TVWREAR : {
  465.                             x1=ver1.x*scale,y1=-ver1.z*scale;
  466.                             x2=ver2.x*scale,y2=-ver2.z*scale;
  467.                             x3=ver3.x*scale,y3=-ver3.z*scale;
  468.                             break;
  469.                         }
  470.                         case TVWPERSP : {
  471.                             //urgl !? ;-)
  472.                             break;
  473.                         }
  474.                     }
  475.  
  476.                     sprintf(buffer,"%g %g %g %g %g %g p\n",x1,y1,x2,y2,x3,y3);
  477.                     if(colors) {
  478.                         if(pln->materialNode->index) {
  479.                             sprintf(buffer,"%ld %g %g %g %g %g %g p\n",pln->materialNode->index-1,x1,y1,x2,y2,x3,y3);
  480.                         } else {
  481.                             sprintf(buffer,"0 %g %g %g %g %g %g p\n",x1,y1,x2,y2,x3,y3);
  482.                         }
  483.                     }
  484.                     if(FPuts(psfile,buffer)!=DOSFALSE) return(RCWRITEDATA);
  485.                 
  486.                     plvi=plvi->next;
  487.                 } while(plv3->next!=NULL);    
  488.             }
  489.         
  490.             /* Get the next polygon */
  491.             pln=pln->next;            
  492.         } while(pln!=NULL);
  493.     }
  494.  
  495.     return(RCNOERROR);
  496. }
  497.  
  498. /********************** Public functions ****************************/
  499.  
  500. /********************************************************************\
  501. *                                                                    *
  502. * Name         : write2EPS                                           *
  503. *                                                                    *
  504. * Description  : Writes a standart Encapsulated PostScript ASCII     *
  505. *                file.                                               *
  506. *                                                                    *
  507. * Arguments    : epsfile  IN : An already opened file stream.        *
  508. *                mesh     IN : Pointer to the mesh.                  *
  509. *                viewtype IN : Type of view.                         *
  510. *                drawmode IN : Drawing mode.                         *
  511. *                width    IN : Width of output media.                *
  512. *                height   IN : Height of output media.               *
  513. *                                                                    *
  514. * Return Value : RCNOERROR                                           *
  515. *                RCWRITEDATA                                         *
  516. *                                                                    *
  517. * Comment      :                                                     *
  518. *                                                                    *
  519. \********************************************************************/
  520. ULONG write2EPS(BPTR epsfile,TOCLMesh *mesh,
  521.                 ULONG viewtype,ULONG drawmode,
  522.                 ULONG width,ULONG height) {
  523.  
  524.     ULONG                retval;
  525.     TOCLFloat            x,y,w,h;
  526.  
  527.     retval=writeepsheader(epsfile,mesh,0,0,width,height,drawmode);
  528.     if(retval!=RCNOERROR) return(retval);
  529.  
  530.     // compute the drawing box of the postscript output
  531.     x=width*Ci_MARGINPERFAC;
  532.     w=width-2*x;
  533.     y=height*Ci_MARGINPERFAC;
  534.     h=height-2*y;
  535.  
  536.     retval=writeepsbody(epsfile,mesh,viewtype,drawmode,x,y,w,h);
  537.     if(retval!=RCNOERROR) return(retval);
  538.  
  539.     retval=writeepsfooter(epsfile);
  540.  
  541.     return(RCNOERROR);
  542. }
  543.  
  544. /************************* End of file ******************************/
  545.